//正则表达式
let reg1:RegExp = new RegExp('jspang');
// console.log(reg1);
let reg2:RegExp = new RegExp('jspang','gi');
// console.log(reg2);
//其实以上两种方式打印出来就是字面量的赋值方法


//使用字面量的方法来声明正则表达式
let reg3:RegExp = /jspang/;
let reg4:RegExp = /jspang/gi;
// console.log(reg3);
// console.log(reg4)


//RegExp中的常用方法
//test    exec

let reg5:RegExp = /jspang/i
let website:string = 'jspang.com'
let result1:boolean = reg5.test(website);
console.log(result1);//true

//exec
let reg6:RegExp = /jspang/i
let website1:string = 'jspang.com';
console.log(reg6.exec(website1));